﻿using Basic.HrGatewayModular.Interface;
using Basic.HrGatewayModular.Model.EmpSign;
using Basic.HrRemoteModel.EmpSignatureFile.Model;
using Basic.HrRemoteModel.PdfSign.Model;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.HrGatewayModular.Api
{
    internal class EmpSignFileApi : ApiController
    {
        private readonly IEmpSignFileService _Service;

        public EmpSignFileApi ( IEmpSignFileService service )
        {
            this._Service = service;
        }
        public SignResult PdfSign ( StringParam<WriteSignPdf> obj )
        {
            return this._Service.PdfSign(base.UserState.ToEmpId(), obj.Id, obj.Value);
        }
        public PagingResult<SignFileDto> Query ( PagingParam<SignQueryParam> query )
        {
            return this._Service.Query(base.UserState.ToEmpId(), query);
        }
        public long Add ( EmpSignAdd datum )
        {
            return this._Service.Add(datum, base.UserState.ToEmpId());
        }

        public string Accredit ( ApplyAccredit obj )
        {
            return this._Service.AddAccredit(base.UserState.ToEmpId(), obj);
        }

        public void Delete ( [NumValidate("hr.emp.sign.id.error", 1)] long id )
        {
            this._Service.Delete(id, base.UserState.ToEmpId());
        }

        public SignFileItem[] Gets ()
        {
            return this._Service.Gets(base.UserState.ToEmpId());
        }

        public long UpSign ( UpEmpSign datum )
        {
            return this._Service.UpSign(datum, base.UserState.ToEmpId());
        }
    }
}
